package com.hupu.service;

import com.hupu.dao.FeignDao;
import com.hupu.dao.UserDao;
import com.hupu.dao.UserDaoHys;
import com.hupu.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserDao userDao;

    //演示熔断
    @Autowired
    private UserDaoHys userDaoHys;

    @Autowired
    private FeignDao feignDao;

    public List<User> queryUserByIds(List<Long> ids) {
        List<User> list = new ArrayList<>();
        for (Long id : ids) {
//            User user = userDao.queryUserById(id);
            User user = userDaoHys.queryUserById(id);
//            User user = feignDao.queryUserById(id);
            list.add(user);
        }
        return list;
    }
}
